/**
 *
 */
Ext.define('vacake.view.KeyCall', {
    extend: 'Ext.List',
    xtype: 'keyCall',
    config: {
        items: [
            {
                docked: 'top',
                xtype: 'titlebar',
                id: 'titleBar',
                title: '一键呼叫',
                items: {
                    text: '返回', ui: 'action-back',
                    handler: function () {
                        Ext.Viewport.remove(this.up('keyCall'), true);
                    }
                }
            }
        ],
        store: 'KeyCall',
        cls:'x-list2',
        emptyText: '<div style="width: 100%; height: 100%; text-align: center; vertical-align: middle">' +
            '<img width="94" height="94" src="resources/images/null.png" style="margin-top:100px;"   /> ' +
            '<div class="height30 color2 font2">暂时没有一键呼叫</div>' +
            '</div>',
        itemTpl:
            "<div style='line-height: 22px'>"+
                "<img src='resources/images/tel.png' style=' float:left; width:40px; height:44px; margin-right: 16px'/>"+
                "<div class='font2 color2'>{name}</div>"+
                "<div class='font2 color5' id='number'>{number}</div>"+
            "</div>",
//            '<div style="vertical-align: middle;">' +
//            '<span style="font-size: 16px;white-space: nowrap;padding-left: 5%;" class="height30; font2 color2">{name}<span>' +
//            '<span style="display: block;padding-left: 5%;" class="height20 font2 color5">{number}<span>' +
//            '</div>',
        onItemDisclosure: true,
        listeners: {
            initialize: function () {
                var keyCallStore = Ext.getStore('KeyCall');
                keyCallStore.load({params: {cadid: window.localStorage.getItem('app_district_id') } });
            },
            painted: function () {
                Ext.Viewport.unmask();
            },
            itemtap:function (list, index, element, record) { 
                 cordova.exec(function(success){}, function(error){}, "Redirect", "callNumber", [record.get('number')]);
                 return false;
            },
            back: function() {
                Ext.Viewport.remove(Ext.Viewport.getActiveItem(), true);
            }
        }
    }

});

